<script type="text/javascript">
	$(document).ready(function(){
		
        $("ul#chpk li").click(function(){
			var $idch = $(this).attr("id");
            $("ul#chpk li").removeClass();
            $(this).addClass('active');
            $.ajax({
                url: "<?php echo base_url();?>/mod_phongkham/mod_phongkham/hoidap",
                type: "POST",
                data:"idch="+$idch,
                success: function(data){
                    $("#introch").html(data);
                }
            }); 
		});
	   $('#sm').click(function() {
            var name = $("#name").val();
            var email = $("#email").val();
            var phone = $("#phone").val();
            var address = $("#address").val();
            var comment = $("#comment").val();
            var captcha = $("#captcha").val();
            
            $.ajax({
                url: "<?php echo base_url();?>/mod_phongkham/mod_phongkham/xulyform",
                type: "POST",
                cache: false,
                data: "captcha="+captcha+"&name="+name+"&email="+email+"&phone="+phone+"&address="+address+"&comment="+comment,
                success: function(html){
                    $(".error").html(html);
                }
            });
            $.ajax({
                url: "<?php echo base_url();?>/mod_phongkham/mod_phongkham/captchacm",
                type: "POST",
                cache: false,
                data: "load=return",
                success: function(html){
                    $(".cp").html(html);
                }
            });
            return false;
        });
        $(function(){ $("label").inFieldLabels(); });
    });
        
</script>
<div class="introch-inner"><?php 
    if (!empty($cauhoi)): ?>
    <div class="name"><?php echo $user->username;?></div>
    <div class="question"><p style="margin: 0;"><?php echo $cauhoi->fulltext; ?></p>  </div>
    <div class="answer">
    <?php
        if ($cauhoi->ans == 1){
            echo '<p class="title">Phòng khám trả lời:</p>';
            echo '<ul>';
                foreach($traloi as $tl){
                    echo '<li>'.$tl->content.'</li>';
                }
            echo '</ul>';
        }
        else{
            echo '<p class="title">Chưa có câu trả lời cho câu hỏi này.</p>';
        }
    echo '</div>';
    
    ?>
    
    <div class="comment">
    <?php if (!empty($binhluan)){
        echo '<p class="title">Bình luận:</p>';
        echo '<ul>';
        foreach($binhluan as $bl){
            echo '<li><p><strong>'.$bl->name.' : </strong>'.$bl->content.'</p></li>';
        }
        echo '</ul>';
        echo '<p style="font-weight:bold; color: #00f">phan trang</p>';
    }
    ?>
    
    </div>
    <?php 
    
    echo '<p class="title">Gửi bình luận:</p>';
    echo '<div class="error">';
    echo empty($thongbao)?'':$thongbao;
    echo '</div>';
    $attributes = array('id' => 'sendcomment');
    echo form_open('',$attributes); 
    
    ?>
    <fieldset>
        <div class="fLeft" style="width:49%;" >
            <p class="fLeft" >
                <label for="name">Họ tên</label><br />
                <input type="text" id="name" name="name" title="Họ tên" value="<?php //echo isset($post['name'])?$post['name']:'';?>" size="50" />
    
            </p>
            <p class="fLeft" >
                <label for="address">Địa chỉ</label><br />
                <input type="text" id="address" name="address" title="Địa chỉ" value="" size="50" />
            </p>
        </div>
            
        <div class="fRight" style="width:49%">
            <p class="fRight">
                <label for="email">Email</label><br />
                <input type="text" id="email" name="email" title="Email" value="" size="50" />
            </p>
            <p class="fRight">
                <label for="phone">Điện thoại</label><br />
                <input type="text" id="phone" name="phone" title="Điện thoại" value="" size="50" />
            </p>
         </div>
        <div class="fLeft" style="width:660px">
            <p>
                <label for="comment">Nội dung bình luận</label><br />
                <textarea rows="10" id="comment" name="comment" cols="100"></textarea>
            </p>
        </div>
        
        <div class="fLeft" style="width:660px">
            <div class="colx fLeft"><p style="margin:0;line-height:30px"><strong>Mã xác nhận: </strong></p></div>
            <div class="colx fLeft"><p style="margin:0;line-height:30px" class="cp"><?php echo $captcha ; ?></p></div>
            <div class="colx fLeft"><p style="margin:0;line-height:30px"><input style="margin:0;height:20px;width:150px" type="text" id="captcha" name="captcha" title="Captcha" value="" size="50" /></p></div>
        </div>
        <div class="fLeft" style="width:660px">
            <input id="sm" class="buttonch" type="submit" value="Gửi thông tin" />
            <input type="reset" class="buttonch" value="Nhập lại" />
        </div>
    </fieldset>
    </form>
    <?php endif; /*Het if ton tai cau hoi dong 39 */ ?>
</div>